﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.Inspections;

namespace br.com.portocs.unidaacademico.repositorio.conventions
{
    public class CustomManyToManyConvention : ManyToManyTableNameConvention
    {        
        protected override string GetBiDirectionalTableName(IManyToManyCollectionInspector collection, IManyToManyCollectionInspector otherSide)
        {
            return collection.EntityType.Name + "_" + otherSide.EntityType.Name;
        }

        protected override string GetUniDirectionalTableName(IManyToManyCollectionInspector collection)
        {
            return collection.EntityType.Name + "_" + collection.ChildType.Name;

        }
    }
}
